<?php
	//Xay dung tim kiem
	$ssFilter 		= $this->arrParam['ssFilter'];
	$page = '';
	if(isset($this->arrParam['page'])){
		$page = '/page/' . $this->arrParam['page'];
	}
	$action_link 	= $this->baseUrl($this->currentController . '/filter/type/order');
	
	$lblID 			= $this->cmsLinkSort('ID','c.id',$ssFilter,$this->imgUrl . '/admin',$action_link);
	$lblTenkh 		= $this->cmsLinkSort('Tên khách hàng','c.name_khachhang',$ssFilter,$this->imgUrl . '/admin',$action_link);
	$lblTennv 		= $this->cmsLinkSort('Người thu tiền','c.name_thutien',$ssFilter,$this->imgUrl . '/admin',$action_link);
	$lblTenclub 	= $this->cmsLinkSort('Tên câu lạc bộ','c.name_caulacbo',$ssFilter,$this->imgUrl . '/admin',$action_link);
	$lblSotiendong 		= $this->cmsLinkSort('Số tền đóng','c.sotiendong',$ssFilter,$this->imgUrl . '/admin',$action_link);
	$lblNgaydong		= $this->cmsLinkSort('Ngày đóng','c.ngaydong',$ssFilter,$this->imgUrl . '/admin',$action_link);
	$lblNgayhethan 		= $this->cmsLinkSort('Ngày hết hạn','c.ngayhethan',$ssFilter,$this->imgUrl . '/admin',$action_link);
	
	
	$lblStatus 		= $this->cmsLinkSort('Status','c.status',$ssFilter,$this->imgUrl . '/admin',$action_link);
	$lblOrder 		= $this->cmsLinkSort('Order','c.order',$ssFilter,$this->imgUrl . '/admin',$action_link);
// 	$lblCategory	= $this->cmsLinkSort('Danh mục','category_name',$ssFilter,$this->imgUrl . '/admin',$action_link);
	$lblhits		= $this->cmsLinkSort('Lượt xem','c.hits',$ssFilter,$this->imgUrl . '/admin',$action_link);
	$lblLanguage	= $this->cmsLinkSort('Ngôn ngữ','c.lang_code',$ssFilter,$this->imgUrl . '/admin',$action_link);
	
	$keywords = $this->formText('keywords',$ssFilter['keywords'],array('class'=>'txtshort txtsearch'));
	
	//---------------------GROUP SELECTBOX --------------------//
// 	$linkSlbCategory = $this->baseUrl($this->currentController . '/filter/type/cat_id');
// 	$selectCategory = $this->cmsSelect('cat_id',$ssFilter['cat_id'],$this->slbCategory,array('style'=>'min-width:200px;','onchange'=>"OnSubmitForm('" .$linkSlbCategory ."')"));
	
	//---------------------CÂU LẠC BỘ SELECTBOX --------------------//
	//var_dump($this->slbClb);
	$linkSlbClb = $this->baseUrl($this->currentController . '/filter/type/id_clb');
	$this->slbClb[0] = 'Chọn câu lạc bộ';
	ksort($this->slbClb);
	$selectClb = $this->formSelect('id_clb',$ssFilter['id_clb'],array('style'=>'min-width:200px;','onchange'=>"OnSubmitForm('" .$linkSlbClb ."')"),$this->slbClb);
	
	
	//---------------------SELECT BLOCKS --------------------//
	
	$selectLanguages = $this->slbLanguages;
	$linkSlbLanguages = $this->baseUrl($this->currentController . '/filter/type/lang');
	$selectLanguages = $this->formSelect('lang_code',$ssFilter['lang_code'],array('onchange'=>"OnSubmitForm('" .$linkSlbLanguages ."')"),$selectLanguages);
	
	$linkSearch = $this->baseUrl($this->currentController . '/filter/type/search/key/1');
	$btnSearch = $this->formButton('search-now','Tìm',array('class' => 'btnsearch', 'onclick'=>"OnSubmitForm('" .$linkSearch . "')"));
	
	$linkResetSearch = $this->baseUrl($this->currentController . '/filter/type/search/key/0');
	$btnResetSearch = $this->formButton('clear-keywords','Xóa',array('class' => 'btnsearch', 'onclick'=>"OnSubmitForm('" .$linkResetSearch ."')"));
	
	$strSearch = $keywords . ' ' . $btnSearch . ' ' . $btnResetSearch;

	
	
	$lblClb	= $this->cmsLinkSort('Chọn câu lạc bộ','c.name_caulacbo',$ssFilter,$this->imgUrl . '/admin',$action_link);
					
	$strSearchRight = $selectClb ;
?>
<div class="left_content">
	<?php echo $this->render($this->arrParam['controller'] . '/toolbar/left.php');?>
</div>

<div class="right_content">
	<div class="block_breadcrumb">
		<?php echo $this->blkBreadcrumbs('default'); ?>
	</div>
	<div class="appContent">
	<?php echo $this->render($this->arrParam['controller'] . '/toolbar/index.php');?>
		
	<form action="" method="post" name="appForm">
	 
	<div class="tblForm">
	
		
		<div class="formList goc5">
			<div class="appTop goct5">
				<div class="block_filter">
					<div class="fl">
						<div class="listSearch">
							<?php echo $strSearch; ?>
							<div class="clr"></div>			
						</div>
					</div>
					<div class="fr">
						<?php echo $strSearchRight;?>
					</div>
					<div class="clr"></div>
				</div>
			</div>
			<div class="appBody">
				<table class="tblList">
					<tr>
						<th><a href="">#</a></th>
						<th width="20"><input type="checkbox" name="checkbox" id="checkbox" onclick="checkedAll()"></th>
						<th><a href=""><?php echo $lblTenkh;?></a></th>
						<th><a href=""><?php echo $lblTenclub; ?></a></th>
						<th><a href=""><?php echo $lblSotiendong; ?></a></th>
						<th><a href=""><?php echo $lblNgaydong; ?></a></th>
						<th><a href=""><?php echo $lblNgayhethan; ?></a></th>
						<th><a href=""><?php echo $lblTennv; ?></a></th>
						<th><a href=""><?php echo $lblID;?></a></th>
						<th><a href="">Thao tác</a></th>
					</tr>
					
					<?php
				foreach ($this->Items as $key => $val){
					$id 			= $val['id'];
					$Tenkh			= $val['name_khachhang'];
					$Tenclub		= $val['name_caulacbo'];
					$Sotiendong 	= $val['sotiendong'];
					$Ngaydong 		= $val['ngaydong'];
					$Ngayhethan 	= $val['ngayhethan'];
					$Tennv 			= $val['name_thutien'];	
					//$linkInfo		= $this->baseUrl($this->currentController . '/info/id/' . $id . $page);
					$linkInfo 		='';
					$btnInfo		= $this->cmsIconButton('Xem thông tin', $this->imgUrl . '/admin/icon_info.png', $linkInfo);
					
					$linkEdit		= $this->baseUrl($this->currentController . '/edit/id/' . $id );
					$btnEdit		= $this->cmsIconButton('Sửa', $this->imgUrl . '/admin/icon_edit.png', $linkEdit);
					
					$linkDelete		= $this->baseUrl($this->currentController . '/delete/id/' . $id );
					$btnDelete		= $this->cmsIconButton('Xóa', $this->imgUrl . '/admin/publish_r.png', $linkDelete);
					
					$strIconButton 	=  $btnEdit.''.$btnInfo . ' ' . $btnDelete;
					
					$alias = '<p class="smallsub">(Url: ' . $val['url'] . ' )</p>';
					$hoten 	= '<b><a href="' . $linkInfo . '">' . $hoten . '</a></b>';
				
					$cid 			= $this->formCheckbox('cid[]',$val['id']);
					
					$classRow = 'row1';
					if($key % 2 == 0)
					$classRow = 'row0';
						
			?>
			<tr class="<?php echo $classRow;?>">
				<td align="center"><?php echo $key + 1;?></td>
				<td align="center"><?php echo $cid;?></td>
				<td align="left"><b><a href="<?php echo $linkEdit;?>"><?php echo $Tenkh;?></a></b></td>
				<td align="left"><a href="<?php echo $linkEdit;?>"><?php echo $Tenclub;?></a></td>
				<td align="right"><a href="<?php echo $linkEdit;?>"><span class="auto_numberic red"><?php echo $Sotiendong;?></span></a></td>
				<td align="left"><a href="<?php echo $linkEdit;?>"><?php echo $Ngaydong;?></a></td>
				<td align="center"><a href="<?php echo $linkEdit;?>"><?php echo $Ngayhethan;?></a></td>
				<td align="center"><a href="<?php echo $linkEdit;?>"><?php echo $Tennv;?></a></td>
				<td align="left"><a href="<?php echo $linkEdit;?>"><?php echo $id;?></a></td>
				<td align="center"><?php echo $strIconButton;?></td>
				
			</tr>
			<?php
				} 
			?>
					
				 
				</table>
			</div>
			<div class="appBottom">
				<div class="pagination">
							<?php
								$currentUrl = $this->baseUrl($this->currentController . '/index');
								echo $this->paginationControl($this->paginator,'Sliding','pagination.phtml',array('currentUrl'=>$currentUrl)); 
							?>
					
				</div>
			</div>
		</div>
	</div> 
	</form>
	</div>
</div>
<div class="clr"></div>	
